#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
    int n = 0;
    scanf("%d", &n);
    int a[1000] = { 0 };
    int i = 0;
    int count = 0;
    int id = 1;
    while (count < n - 1)
    {

        if (a[i] == 0)
        {
            if (id == 3)
            {
                a[i] = 1;
                count++;
                id = 1;
            }
            else
            {
                id++;
            }

        }

        i = (i + 1) % n;
    }


    for (i = 0; i < n; i++)
    {
        if (a[i] == 0)
        {
            printf("%d", i + 1);
        }
    }


    return 0;
}